from django.shortcuts import render

from userapp.model_two.models import Employee, DeptModel


# Create your views here.

def test01(request):
    # 查询出来的是一个对象，使用get查询他就不是兰加载了
    emp = Employee.objects.get(pk=7)
    # 通过过滤条件来查询数据
    data1 = Employee.objects.filter(pk=10).values('name', 'rules__name')
    print(data1)
    return render(request, 'demo/index.html', locals())


# 模板二采用if判断
def test02(request):
    emp = Employee.objects.get(pk=7)
    res = Employee.objects.get(pk=10)
    print(emp)
    return render(request, 'demo/demo2.html', locals())


def test03(request):
    # 木板的 继承
    dept = DeptModel.objects.all()
    print(dept)
    return render(request, 'demo/demo3.html', locals())


def test04(request):
    return render(request, 'demot/demo1.html', locals())
